#include "qbddfile.h"

QBDDFile::QBDDFile(QString name)
	: QFile(name),m_index(0)
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	if(open(QIODevice::ReadOnly))
	{
		QTextStream in(this);
		m_header = in.readLine().split(BDD_SEPARATOR);
		in.readLine();

		QString ligne = in.readLine();
		while(!ligne.isNull())
		{
			m_data << ligne.split(BDD_SEPARATOR);
			ligne = in.readLine();
		}
		close();
	}
}

QBDDFile::~QBDDFile()
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
}


QStringList QBDDFile::current()
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	if(m_index < m_data.size())
		return m_data.at(m_index);
	else
		return QStringList();
}